package com.twu.biblioteca;

import java.util.InputMismatchException;
import java.util.Scanner;


public class Menu{

    public static int checkUserInput(String input) {

        try{
            int choice= Integer.parseInt(input);
            if(choice>0 && choice<4)
            {
                return choice;
            }
            else if(choice==4)
            {
                return 4;
            }
            throw new Exception();

        }
        catch(Exception e)
        {
            System.out.println("Select a valid option!");
            return 0;
        }
    }


    public static String getUserInputIsbn()
    {
        return "Enter the Isbn :";

    }

    public static String getLibraryUserInputOption()
    {
        return "1.List Book  2.CheckOut Book  3.Return Book  4.Back";
    }
    public static String getMainUserInputOption()
    {
        return "1.Books Library  2.Movie Library 3.User Information  4.Exit";
    }

    public static String getUserInputChoice()
    {
        Scanner sc=new Scanner(System.in);
        return sc.next();
    }

    public static String getLibraryUserInputOptionForMovie()
    {
        return "1.List Movies  2.CheckOut Movie  3.Return Movie  4.Back";
    }

    public static String getCustomerID()
    {
        Scanner sc=new Scanner(System.in);
        System.out.print("User Id :");
        String userId=sc.next();
        System.out.print("Password :");
        String password=sc.next();
        return userId+":"+password;
    }
    public static boolean invalidUserOption()
    {
        Scanner sc=new Scanner(System.in);
        System.out.println("Invalid Credential .Do you want try again?(y/n)");
        if(sc.next().equalsIgnoreCase("y"))
        {
            return true;
        }
        return false;
    }

    public static String getUserInputMovie() {
        return "Enter the Name :";
    }
}
